import pool from "../../db/index.js"


export const addStudent = async (req, res) => {
    console.log(req);
    if (!req.query.sname || !req.query.course) {
        res.send({
            status: 1,
            msg: '新增失败',
            data: []
        })
        return
    }
    try {
        let data = await pool.query("insert into  `sys_student` (sname,cno,phone,sage,tno,address, course) VALUES ('"
            + req.query.sname + "','" + req.query.cno + "','" + req.query.phone + "','" + req.query.sage + "','" + req.query.tno + "','"
            + req.query.address + "','" + req.query.course + "')")
        res.send({
            status: 0,
            msg: '新增成功',
            data: []
        })
    } catch (e) {
        res.send({
            status: 1,
            msg: '新增失败',
            data: e
        })
    }
}